﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Framework;

namespace Bepo.Model.Data
{
    public class BusinessModelRecord
    {
        public Guid Id { get; set; }
        public string Name { get; set; }
        public string Description { get; set; }
        public DateTime CreatedOn { get; set; }
        public string SerializedProperties { get; set; }

        public static BusinessModelRecord Create(string name, string description)
        {
            var newBM = new BusinessModelRecord { Id = Comb.NewGuid(), Name = name, Description = description, CreatedOn = DateTime.UtcNow, SerializedProperties = string.Empty };
            newBM.Save();
            return newBM;
        }

        private void Save()
        {
            BepoDB.BusinessModels.Save(this);
        }
    }
}
